package com.dubbo.test.redisNew;

import com.dubbo.test.lock.JedisConnectionUtils;
import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPubSub;

import javax.annotation.PostConstruct;

/**
 * @ Author xsd
 * @ crate time 2020/7/24 9:09
 * @ 描述 订阅消息
 */
public class SubscriberService extends JedisPubSub {
    static Jedis jedis = JedisConnectionUtils.getJedis();

    @Override
    public void onMessage(String channel, String message) {
        System.out.println("channel:"+channel+"======message:"+message);
    }

    public static void main1(String[] args) {
        jedis.subscribe(new SubscriberService(),"channel");
    }
}
